# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=yersinia
pkgver=0.8.2
pkgrel=2
groups=('blackarch' 'blackarch-networking' 'blackarch-scanner')
pkgdesc='A network tool designed to take advantage of some weakness in different network protocols.'
arch=('x86_64' 'aarch64')
url='https://github.com/tomac/yersinia'
depends=('libpcap' 'libnet' 'gtk2')
license=('GPL')
source=("https://github.com/tomac/$pkgname/archive/v$pkgver.tar.gz"
        "$pkgname-noptrix.patch")
sha512sums=('2c7c89f19b6791150c472a6066b6ffaf9ac5b3d1a3d2e6a27f91293bba9a0f72d147266731e5e2670e4bf7e67ccf04b6e353071ca42d3d281b25126c9bfcb1dd'
            'afea5055e006c4685977d7b347a47e97085fc8d88ee72b978ef0866da99cd987bd604cc4051e9a21132c55ab421959006b9091ba9d75bf1f4b5ba0f161ddd7dc')

prepare() {
  cd "$pkgname-$pkgver"

  patch -p2 < "$srcdir/yersinia-noptrix.patch"
}

build() {
  cd "$pkgname-$pkgver"

  if [[ "$CARCH" == "i686" || "$CARCH" == "x86_64" ]];
  then
    ./configure --prefix=/usr --sbindir=/usr/bin \
      --with-pcap-includes=/usr/include/
  else
    ./configure --build=arm --prefix=/usr --sbindir=/usr/bin \
      --with-pcap-includes=/usr/include/
  fi

  make
}

package() {
  cd "$pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" AUTHORS ChangeLog INSTALL \
    NEWS THANKS FAQ
}

